export const indexEnglishKey = {
  A: 2,
  B: 3,
  C: 4,
  D: 5,
  E: 6,
  F: 7,
  G: 8,
  H: 9,
  I: 10,
  J: 11,
  K: 12,
  L: 13,
  M: 14,
  N: 15,
  O: 16,
  P: 17,
  Q: 18,
  R: 19,
  S: 20,
  T: 21,
  U: 22,
  V: 23,
  W: 24,
  X: 25,
  Y: 26,
  Z: 27
}

export const indexEnglish = [
  'popularCity',
  'commonlyCity',
  'A',
  'B',
  'C',
  'D',
  'E',
  'F',
  'G',
  'H',
  'I',
  'J',
  'K',
  'L',
  'M',
  'N',
  'O',
  'P',
  'Q',
  'R',
  'S',
  'T',
  'U',
  'V',
  'W',
  'X',
  'Y',
  'Z'
]


import rxCityLang from "@/locales/lang/impl/pages/control/rxCityLang";
let lang = rxCityLang;
import I18Parse from "@/common/i18Parse.js";
let i18n=function (langKey,text) {
  return I18Parse.getI18Val(lang.rxCityLang,langKey, text)
}
// 首次获取英文
export const listHot = (cityData) => {
  const indexList = indexEnglish.map((item) => {
    return {
      letter: i18n(item,item),
      pageNo: 1,
      pageSize: 5,
      totalPage: 6,
      data: []
    }
  });
  indexList[0].data = cityData.map((item) => item)
  return indexList
}

// 获取常用
export const listFamiliar = (indexList, cityData) => {
  indexList[1].data = cityData.map((item) => item)
  return indexList
}

// 首次获取英文
export const listFn = (indexList, cityData) => {
  cityData.forEach((item) => {
    const key = item.code[0].toUpperCase()
    const IndexKey = indexEnglishKey[key]
    indexList[IndexKey].data.push(item)
  })
  return indexList
}

// 累加英文
export const pushList = (indexList, cityData) => {
  cityData.forEach((item) => {
    const key = item.code[0].toUpperCase()
    const IndexKey = indexEnglishKey[key]
    indexList[IndexKey].data.push(item)
  })
  return indexList
}
